#include <iostream>
using namespace std;
int main()
{
    char a[20],b[20];
    int i,j,e[20];
    __int64 c,d,t;
    while (cin>>a>>b)
    {
        t=1;c=d=0;
        for (i=strlen(a)-1;i>=0;i--)
        {
            if (a[i]=='+')break;
            if (a[i]=='-'){c=-c;break;}
            if (a[i]>='A'&&a[i]<='F')c+=t*(a[i]-'A'+10);
            else c+=t*(a[i]-'0');
            t*=16;
        }
        t=1;
        for (i=strlen(b)-1;i>=0;i--)
        {
            if (b[i]=='+')break;
            if (b[i]=='-'){d=-d;break;}
            if (b[i]>='A'&&b[i]<='F')d+=t*(b[i]-'A'+10);
            else d+=t*(b[i]-'0');
            t*=16;
        }
        c=c+d;t=0;
        if (c<0){cout<<'-';c=-c;}
        if (c==0)e[t++]=0;
        while (c!=0)
        {
            e[t++]=c%16;
            c=c/16;
        }
        for (i=t-1;i>=0;i--)
        {
            if (e[i]>=10)cout<<char(e[i]-10+'A');
            else cout<<e[i];
        }
        cout<<endl;
    }
    return 0;
}
